package com.tech;

import cn.hutool.core.io.FileUtil;
import cn.hutool.json.JSONUtil;
import com.tech.controller.ApiController;
import com.tech.model.GeneratorOption;
import com.tech.model.GeneratorResult;
import com.tech.repo.GlobalConfigEntityRepository;
import com.tech.repo.TemplateEntityRepository;
import com.tech.service.InitializeService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.domain.EntityScan;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.io.File;
import java.util.ArrayList;
import java.util.List;

/**
 * Created by zouyao on 2023/06/02
 */
@EntityScan(basePackages = "com.tech.model")
@SpringBootApplication
@RestController
@RequiredArgsConstructor
@Slf4j
public class Application implements CommandLineRunner{

    public static void main(String[] args) {
        SpringApplication.run(Application.class, args);
        log.info("----- application start success! -----");
    }

    @GetMapping("/health")
    public String health(){
        return "OK";
    }

    private final InitializeService initializeService;
    private final ApiController     apiController;

    @Override
    public void run(String... args) throws Exception {
        initializeService.init();
    }
}
